package com.cloud.tsp.controller;

import com.cloud.api.domain.forward.QueryForwardDetail;
import com.cloud.api.domain.forward.VehicleForwardError;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.mybatis.domain.TableDataInfo;
import com.cloud.tsp.service.IVehicleForwardErrorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author haohaibo
 * @since 2024-01-30
 */
@RestController
@RequestMapping("/vehicle-forward-error")
public class VehicleForwardErrorController {

    @Resource
    private IVehicleForwardErrorService vehicleForwardErrorService;


    @Tag(name = "v1.0")
    @Operation(summary = "转发详情列表（管理）")
    @PostMapping("/getForwardError")
    @Log(title = "转发车辆管理-转发详情列表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<VehicleForwardError> selectForwardError(@RequestBody @Validated QueryForwardDetail para){
        return vehicleForwardErrorService.selectForwardError(para);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "导出转发详情列表")
    @PostMapping("/exportForwardList")
    @Log(title = "转发车辆管理-导出转发详情列表", businessType = BusinessType.EXPORT, operatorType = OperatorType.MANAGE)
    public void exportForwardList(QueryForwardDetail para, HttpServletResponse response) throws IOException {
        vehicleForwardErrorService.exportForwardList(para,response);
    }

}